package com.dgut.leave.service;

import java.util.Map;

import org.activiti.engine.runtime.ProcessInstance;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.domain.Specification;

import com.dgut.leave.entity.Leave;
import com.dgut.leave.entity.LeaveQueryDTO;

public interface ILeaveService {
	// 请假业务
	public void save(Leave leave, String status);// 保存

	public void delete(Long id);// 删除

	public Leave findOne(Long id);// 查找一个假单

	public Page<Leave> findLeave(String userId, Pageable pageable);// 分页查找假单

	public Page<Leave> findPage(Specification<Leave> spec, Pageable pageable); // 动态条件查询
	// 请假业务:高级查询(可扩展)

	// 流程业务
	// 1.启动流程
	public ProcessInstance startWorkflow(Long leaveId, Map<String, Object> variables);// findOne(Long id);
	// 2.查询流程任务

	public Page<LeaveQueryDTO> findTodoTasks(String userId, Pageable pageable);

	// 3.签收流程任务
	public void claim(String taskId, String userId);

	// 4.完成流程任务
	public void complete(String taskId, Map<String, Object> variables);

	// 5.结束(终止)流程实例

	// 6.查询运行中的流程
	public Page<LeaveQueryDTO> findRunningProcessInstaces(Page<Leave> page, int[] pageParams);

	// 7.查询已结束的流程
	public Page<LeaveQueryDTO> findFinishedProcessInstaces(Page<Leave> page, int[] pageParams);
	// 8.查询流程定义对象
	// protected ProcessDefinition getProcessDefinition(String processDefinitionId);
}
